<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of category
 * 
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Sitelogo extends CI_Controller {

    //put your code here


    function sitelogo() {
        parent :: __construct();
        $this->commoncall->check_admin_login();
    }

    function index() {
        $this->load->view('admin/admin_sitelogo.php');
    }

    public function do_upload() {
        if ($_FILES['userfile']['error'] == 0) {
            $ext = preg_replace("/.*\.([^.]+)$/", "\\1", $_FILES['userfile']['name']);
            //$filename= "sitelogo.".$ext;
            $filename = 'sitelogo.gif';
            $config['file_name'] = $filename;
            $config['upload_path'] = './images/';
            $config['allowed_types'] = 'gif';
            $config['overwrite'] = true;
            $config['remove_spaces'] = true;
            $this->load->library('upload', $config);
            if (!$this->upload->do_upload('userfile')) {
                $this->session->set_flashdata('message', $this->upload->display_errors('<p class="error">', '</p>'));
            }
            redirect('admin/sitelogo');
        } else {
            $this->session->set_flashdata('message', 'Please Choose a correct file');
            redirect('admin/sitelogo');
        }
    }

}